package mk.com.ldm.corepoint.administration.client;

import java.util.ArrayList;
import java.util.Map;

import mk.com.ldm.corepoint.administration.shared.ConfigurationObject;
import mk.com.ldm.corepoint.administration.shared.DataBaseObject;
import mk.com.ldm.corepoint.administration.shared.EventObject;
import mk.com.ldm.corepoint.administration.shared.PermissionsObject;
import mk.com.ldm.corepoint.administration.shared.SimpleObject;
import mk.com.ldm.corepoint.administration.shared.TableData;
import mk.com.ldm.corepoint.administration.shared.UserObject;

import com.google.gwt.user.client.rpc.AsyncCallback;

public interface CoreServiceAsync {
	public void login(String username, String password ,AsyncCallback<String> callback);	
	public void loginCheck(String username, String hash, AsyncCallback<Boolean> callback);
	public void mapObject(String objectName, String type, String username, AsyncCallback<ArrayList<?>> callback);
	public void getProjects(AsyncCallback<ArrayList<String>> callback);
	public void createProject(String name, AsyncCallback<Boolean> callback);
	public void generateUserAndPermissionsMap(UserObject user, AsyncCallback<Boolean> callback);
	public void generateConfigurationMap(String objectName, String username, ArrayList<ConfigurationObject> items, ArrayList<Boolean> simple, AsyncCallback<Boolean> callback);
	public void generateSimpleMap(String objectName, String username, ArrayList<SimpleObject> items, AsyncCallback<Boolean> callback);
	public void generatePermissionsMap(String username, ArrayList<PermissionsObject> items, AsyncCallback<Boolean> callback);
	public void generateEventMap(String objectName, ArrayList<EventObject> items, AsyncCallback<Boolean> callback);
	public void selectProject(String projectName, AsyncCallback<String> callback);
	public void createDataBase(String name, AsyncCallback<Boolean> callback);
	public void getUsers(AsyncCallback<ArrayList<UserObject>> users);
	/**
	 * Retrieves a key -> value pair from the specified table, use this method to populate widgets like 
	 * {@link com.google.gwt.user.client.ui.TextBox TextBox} , {@link com.google.gwt.user.client.ui.RadioButton CheckBox} list, 
	 * {@link com.google.gwt.user.client.ui.RadioButton RadioButton} list
	 * @param table - the name of the database table
	 * @param columns - key (usually id) column, value (name, type...) column, other columns are considered to be conditions
	 * @param callback returns a {@link java.util.HashMap HashMap&lt;String, String&gt;} key -> value
	 */
	public void getKeyValuePairFromTable(String table, ArrayList<DataBaseObject> columns, AsyncCallback<Map<String, String>> callback);
	public void getTableData(String table, ArrayList<DataBaseObject> columns, boolean displayConditions, AsyncCallback<ArrayList<TableData>> callback);
	public void generateApplicationMap(ArrayList<String> settings, AsyncCallback<Boolean> callback);
}